package com.lw.algorithm.base;

import com.lw.algorithm.service.CalTimeService;
import com.lw.algorithm.utils.CalTimeUtils;
import com.lw.algorithm.utils.TestCaseUtils;

/**
 * 选择排序
 * @author Administrator
 *
 */
public class SelectSort implements CalTimeService{

	public void excute(int[] arr) {
		int temp = 0;
		for(int i = 0;i < arr.length;i++){
			for(int j = i + 1;j < arr.length;j++){
				if(arr[j] < arr[i]){
					temp = arr[i];
					arr[i] = arr[j];
					arr[j] = temp;
				}
			}
		}
	}
	
	public static void main(String[] args) {
		int[] arr = TestCaseUtils.getRandomArray(100000, 10000);
		CalTimeService calTime = new SelectSort();
		CalTimeUtils.excute(calTime, arr);
	}
}
